﻿using System;

using COUP.Core.Entities;

namespace COUP.Core.Networking
{
    public class SpawnPacket : Packet
    {
        public SpawnPacket(Character Entity)
        {
            Length = (ushort)(57 + Entity.Name.Length);
            Type = 1014;
            Int(Entity.UniqueID);
            Int(Entity.Model);
            Int((uint)Entity.StatusFlags);
            Short(Entity.GuildID);
            Short(Entity.GuildRank);

            Int(Entity.Equipment.GetItem(0).StaticID);
            Int(Entity.Equipment.GetItem(2).StaticID);
            Int(Entity.Equipment.GetItem(4).StaticID);
            Int(Entity.Equipment.GetItem(3).StaticID);

            Short(Entity.X, 44);
            Short(Entity.Y);
            Short(Entity.Hair);
            Byte((byte)Entity.Angle);
            Byte(Entity.Action);
            Byte(1);
            StringWithLength(Entity.Name);
        }

        public SpawnPacket(Monster Entity)
        {
            Length = (ushort)(57 + Entity.Name.Length);
            Type = 1014;
            Int(Entity.UniqueID);
            Int(Entity.Model);

            Short(Entity.Health, 40);
            Short(Entity.Level);
            Short(Entity.X);
            Short(Entity.Y);
            Byte((byte)Entity.Angle, 50);
            Byte(Entity.Action);
            Byte(1);
            StringWithLength(Entity.Name);
        }
    }
}
